package hlju.edu.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;


public class DBHelper extends SQLiteOpenHelper { 

	private static final String DBName = "SEC.db";
	private static final String TableName = "SEC_info";
	private static final int DB_Version = 1;
	
	public static final String Key_Date = "SEC_date";
	public static final String Key_Time = "SEC_time";
	public static final String Key_Title = "SEC_title";
	public static final String Key_Add = "SEC_add"; 
	public static final String Key_Text = "SEC_context";
	

	private SQLiteDatabase db;
	
	public DBHelper(Context context) {
		super(context, DBName, null, DB_Version);
	}
	@Override
	public void onCreate(SQLiteDatabase db) {
		db.execSQL("CREATE TABLE SEC_info (_id INTEGER PRIMARY KEY AUTOINCREMENT, SEC_date varchar(20), SEC_time varchar(20),SEC_title varchar(30),SEC_add varchar(30),SEC_context text)");
	}
	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		db.execSQL("DROP TABLE IF EXISTS " + TableName);
	}
	public void close(){
		if(db != null){
			db.close();
			db = null;
		}
	}
	
}
